﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace AccessControl.Wpf.ViewModels
{
	abstract class ActiveItemViewModelManager : ViewModel
	{
		#region Fields

		private ViewModel _ActiveItem;
		private ObservableCollection<ViewModel> _ViewModels = new ObservableCollection<ViewModel>();

		#endregion

		#region Public Properties

		protected virtual void OnActiveItemChanging(ViewModel oldValue, ViewModel newValue) { }
		
		public ViewModel ActiveItem
		{
			get { return _ActiveItem; }
			set
			{
				if (_ActiveItem != value)
				{
					OnActiveItemChanging(_ActiveItem, value);
					_ActiveItem = value;
					NotifyPropertyChanged("ActiveItem");

				}
			}
		}

		public IList<ViewModel> ViewModels
		{
			get { return _ViewModels; }
		}
		
		#endregion
	}
}
